
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:moonplay/common/app_common.dart';
import 'package:moonplay/model/get_video_url_model.dart';
import 'package:moonplay/utils/http_utils2.dart';
import 'dart:convert' as convert;



/// 加载网络图片
Widget loadNetworkWebpImage(String imageUrl, {String placeholder : "img/placeholder", double width, double height, BoxFit fit: BoxFit.fill}){
  
}


getVideoUrl(url) async {
  Map<String, dynamic> postData = {
      "apiname": "api.php",
      "url": url,
      "time": (DateTime.now().millisecondsSinceEpoch / 1000).toInt(),
      "referer": "https://jx.jiubojx.com/",
      "ckey": "5024cb24136329d40d3386eade24e9b9",
      "vkey": "28519b37df3085d21ee05d30a4f0e2a4",
      "key": "3ea7878ec29dde0551296b7b0f4e3c65",
      "key2": "88314ba79f806502ce705df094d04274",
      "key3": "1c30c054f3f4c641f648fe917c5eax0s",
      "pltfrom": "0"
    };
    FormData formData = FormData.fromMap(postData);
    var _res = await HttpUtil2().request("", data: formData, apiNum: 1, need_login: false);

    Map<String, dynamic> _msg = convert.jsonDecode(_res);
    GetVideoUrlModel _model;
    if(_msg != null && _msg['code'] == 200) {
      _model = GetVideoUrlModel.fromJson(_msg);
    } else {
      CpToast("解析失败");
      return "";
    }
    if(_model != null && _model.url != url) {
      return _model.url;
    } else {
      return "";
    }
}